﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ACC.Extensions.Entities
{
    public class DefectData
    {
        public bool IsChecked { get; set; }
        public int InBit { get; set; }
        public string DefectCode { get; set; }
        public string DefectDescription { get; set; }

        public string StatusName { get; set; }
    }

    //public class ReasonData : NotificationObject
    //{
    //    private bool _IsChecked;
    //    public bool IsChecked
    //    {
    //        get { return _IsChecked; }
    //        set
    //        {
    //            if (_IsChecked == value)
    //                return;

    //            _IsChecked = value;

    //            RaisePropertyChanged("IsChecked");

    //        }
    //    }

    //    private string _ReasonCode;
    //    public string ReasonCode
    //    {
    //        get { return _ReasonCode; }
    //        set
    //        {
    //            if (_ReasonCode == value)
    //                return;

    //            _ReasonCode = value;

    //            RaisePropertyChanged("ReasonCode");

    //        }
    //    }

    //    private string _Reason;
    //    public string Reason
    //    {
    //        get { return _Reason; }
    //        set
    //        {
    //            if (_Reason == value)
    //                return;

    //            _Reason = value;

    //            RaisePropertyChanged("Reason");

    //        }
    //    }

    //}
    public class NotificationObject : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void RaisePropertyChanged(string propertyName)
        {
            VerifyPropertyName(propertyName);

            var handler = PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public void VerifyPropertyName(string propertyName)
        {
            var myType = this.GetType();
            if (myType.GetProperty(propertyName) == null)
            {
                throw new ArgumentException("Property not found", propertyName);
            }
        }
    }
}
